'user strict'

function Obsever(){
    let client = [] //
    let publish
    let subscribe

    publish = function(...args){
        for(let i = -1;client[++i];){
            client[i](args)
        }
    }

    subscribe =function(fn){
        return client.push(fn)
    }
    return{
        publish,
        subscribe
    }

}


let remiliko = Obsever()

//A
remiliko.subscribe(function(data){
    console.log("remiliko send",data, "to A")
})
//B
remiliko.subscribe(function(data){
    console.log("remiliko send",data, "to B")
})

remiliko.publish(['新的更新',1,2,3])